package com.unit.test.service.impl;

import com.unit.test.model.Billing;
import com.unit.test.service.BillingService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.UUID;

/**
 * @author lht
 * @version 1.0
 * @date 2024/2/25 20:25
 * @description
 */
@Service
@Slf4j
public class BillingServiceImpl implements BillingService {
    @Override
    public Billing queryLatestBilling(String accountId) {
        log.info("查询账单信息，账户id为 :{}", accountId);
        return mockQueryBill(accountId);
    }

    @Override
    public Boolean updateBilling(Billing billing) {
        log.info("更新账单状态！");
        return Boolean.TRUE;
    }


    Billing mockQueryBill(String accountId) {
        // 获取账逻辑
        Billing billing = new Billing();
        billing.setBillDate(new Date());
        billing.setBillId(UUID.randomUUID().toString());
        billing.setCustomerId(accountId);
        return billing;
    }
}
